<?php
//include_once("model/itemConfig.php");
//var_dump($organization->getAuthorized());

				$year1= date('Y');
			
	$month= date('m');
	$date= date('d');
$pcodegroup=array();
foreach($inventory as $inventory){
	

	$pcode=$inventory['item']->product_code;
	  $size=$inventory['item']->size;
	
	if (array_key_exists($pcode, $pcodegroup)){
		if (array_key_exists($size, $pcodegroup[$pcode])){
			$pcodegroup[$pcode][$size]->number+=$inventory['number'];
			continue;
		}
		//array_push($pcodegroup['\''.$pcode.'\''],$inventory);
	}
        $pcodegroup[$pcode][$size]=$inventory;

}


$num=count($pcodegroup);
$result="";

 foreach($pcodegroup as $key => $pcode){
         	$two=isset($pcode['02']) ? $pcode['02']['number'] :'0';
			$four=isset($pcode['04']) ? $pcode['04']['number'] :'0';
			$six=isset($pcode['06']) ? $pcode['06']['number'] :'0';
			$eight=isset($pcode['08']) ? $pcode['08']['number'] :'0';
			$ten=isset($pcode['10']) ? $pcode['10']['number'] :'0';
			$twelve=isset($pcode['12']) ? $pcode['12']['number'] :'0';
			$f=isset($pcode['f']) ? $pcode['f']['number'] :'0';			
			$result.="['$key',$two,$four,$six,$eight,$ten,$twelve,$f],";
 }

 $result=substr($result,0,-1);
  
  $h= 230+100*count($pcodegroup);
?>

	<script type="text/javascript" src="js/jsapi.js"></script>
    <script type="text/javascript">
      google.load('visualization', '1', {packages: ['corechart']});
    </script>
    <script type="text/javascript">
      function drawVisualization() {
        // Create and populate the data table.
        var data = google.visualization.arrayToDataTable([
        	
          ['尺寸', '02', '04', '06','08','10', '12','均码'],
          <?php 
			echo  $result;
		  
          ?>
        ]);
      
        // Create and draw the visualization.
        new google.visualization.BarChart(document.getElementById('visualizationTotal')).
            draw(data,
                 {title:"菲雪洛琳库存(数量/款号/尺码)目前状况",
                  width:800, height:<?php echo $h;?>,
                  vAxis: {title: "生产款号",gridlinesaaa: {color: '#CCC'},titleTextStyle: {color: '#FF0000'}},
                  hAxis: {title: "数量"},
                  animation:{
        		  			duration: 1000,
        					easing: 'out'
      				}
             	}
            );
      }
      
      google.setOnLoadCallback(drawVisualization);
    </script>
    

    

	<div class="invertedshiftdown">
		
		<ul>
			<li><a href="?page=accounting_sell_record">销售统计</a></li>
			<li><a href="?page=accounting_distributing">物流统计</a></li>
			<li class="current"><a href="?page=accounting_inventory">库存统计</a></li>
			<li><a href="?page=accounting_report">财政报表</a></li>
 		</ul>




		<form id="myform">
			<input type="text" class="textinput" /> <input class="submit" type="submit" value="搜索" />
		</form>
	</div>
	<br style="clear: both;" />
	

<div id= 'content'>
	    <div class="isa_info">
	  
		<h4><?php echo $message ?></h4><?php 
		echo $condition;
		
		if($condition!="无"){
			echo "<div style='padding-left=10px;'><a href='?page=accounting_inventory'>清空条件</a></div>";
			
		}
		?>
	</div>
	  <br>
		    	    <div id='visualizationTotal'></div>
<br><hr><br>
	<?php
	          echo $table;
	
	?>

   
		<h4>按条件搜索</h4>
		 <form action="" method="post">
            <div class="element">
             <label class="form">机构名</label>
             <select name="orid">
             	<?php
             	
             	foreach($allOrganizations as $org){
             		echo "<option value='$org->id'>$org->name</option>";
             	}
             	?>
             	<option value='' selected>全部</option>
             </select>
            </div>
        	
            <div class="element">
             <label class="form">扫描条码</label>
             <input type="text" id="scan_code" name="scan_code" class="text" maxlength="14" size="14"><div class="important">若为空，搜查结果会显示全部条形码</div>
            </div>
            

             

    <div class="element">
             <label class="form">最小数量</label>
             <input type="text" name="minNum" class="text" size="14"><div class="important">若为空，搜查结果会无最小数量限制</div>
            </div>
   <div style="clear:both;">

    <div class="element">
             <label class="form">最大数量</label>
             <input type="text" name="maxNum" class="text" size="14" ><div class="important">若为空，搜查结果会无最大数量限制</div>
            </div>
   <br>
   <div class="element">
<input type="submit" value="递交" />
        <div class="loading"></div>
    </div>
   </form>
<br>
<br>
<br>


   
<div class="clear"></div>
	</div>